cacti on windows | send alert e-mail

Cacti monitoring on windows

Are you looking for plugin which extend cacti for e-mail alerting when host is inaccessible? No problem.

You can solve it with script to db!

Save this script as the alert.php and run as a schedule task like the poller.php.

________________________________________________________

<?php
mysql_connect(“localhost”, “root”, “password”) or
die(“Could not connect: ” . mysql_error());
mysql_select_db(“cacti”);

$result = mysql_query(“select description from host where status<>3 and disabled<>’on'”);

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$message=”Device “. $row[‘description’] .” is INACCESSIBLE | more on http://localhost/cacti“;
mail(“your-mail@domain.com“, “Cacti ALERT”, $message);

}

mysql_free_result($result);

?>

________________________________________________________________

Example how to run poller.php (the same settings  for alert.php):

poller.bat (alert.bat.) run as a schedule task:

cd c:\php\
start /min php “c:\inetpub\wwwroot\cacti\poller.php”

– – – – – – – – – –

Special thanks to my colleague Roman and Cacti developers!

Leave a comment